Add NUnit + Reqnroll + Playwright BrowserStack SDK sample#2
Conversation
C# sample mirroring xunit-reqnroll-playwright-browserstack, swapped to the NUnit runner. Sample.feature (bstackdemo add-to-cart) + LocalSample.feature (BrowserStack Local via bs-local.com:45454), step definitions with NUnit assertions, Playwright hooks, browserstack.yml (framework: nunit), .sln/.csproj, sanity workflow, and README. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The BrowserStack .NET SDK's auto-generated BrowserStackPatch.cs references the Microsoft.Playwright.NUnit namespace; without the package the build fails with CS0234 'NUnit does not exist in namespace Microsoft.Playwright'. The NUnit+PW reference repo (csharp-playwright-browserstack) includes it too. Verified: 2/2 platforms (Win11/chrome, OSX/webkit) pass real BrowserStack sessions on .NET 8 / arm64. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rohannagariya1
left a comment
There was a problem hiding this comment.
LGTM ✅ — solid NUnit/Reqnroll adaptation, both scenarios verified. Approving.
A few low-risk, optional cleanups (non-blocking):
System.Net.Http 4.3.4andSystem.Text.RegularExpressions 4.3.1in the.csprojare in-box on net8.0 and unnecessary — safe to drop (and they're the kind of legacy refs Semgrep/dependabot tend to flag).browserstack.ymlis missingtestReporting: true(+ the reporting comment block) that both Node siblings include — minor cross-sample consistency.- The workflow's "completed" step calls
checks.createagain rather than updating the in-progress run, so you get one stuckin_progress+ onecompletedcheck. Copied from the xunit reference, so low priority. [id="\31 "]works but is inconsistent with the plain[id="1"]attribute selector used in the JS samples — purely cosmetic.
The Local scenario navigates to bs-local.com:45454 and asserts the page title contains 'BrowserStack Local', but the README never told users to serve anything on that port -- so following it verbatim failed. Document serving a matching local page (and how to point at your own app), and describe the tunnel routing accurately.
5d67d9f
Claude Code PR ReviewPR: #2 • Head: 5d67d9f • Reviewers: stack:code-reviewer SummaryPopulates this previously-skeleton sample repo with a working NUnit + Reqnroll + Playwright (C#) sample driven by the BrowserStack .NET SDK — a faithful conversion of the Review Table
FindingsNo correctness or security issues. Workflow has no injection risk — the untrusted
Verdict: PASS — the cleanest of the three: correct NUnit conversion, no security/injection issues, and verified green on BrowserStack. Only inherited Low-severity dependency hygiene remains. Review run via the BrowserStack AI harness |
Semgrep's supply-chain rule (action not pinned to a full commit SHA) blocks on unpinned tag refs like actions/checkout@v4. Pin all actions to SHAs with a version comment, matching the repo's Semgrep.yml. Also modernizes v3->v4.
Per review: the source tag tracks the onboarding funnel as <repo>:<label>:<version>. Align with csharp-playwright-browserstack (and the SDK Sample Repo Generator spec): use the full repo name and the 'sample-sdk' label instead of the stale 'sample-master' inherited from the xUnit sibling.
Reviewer specified the onboarding-funnel source tag as <repo>:main:v1.0 -- the middle segment is the branch the sample lives on (main), not the 'sample-sdk' label.
…ecklist
The canonical format (Confluence ENG/4080468210) is {f/w-name}:sample-{branch-name}:v{version}.
The sample lives on main, so the branch segment is sample-main (keeps the sample- prefix).
Populates this customer-facing sample repo (previously skeleton: README + CODEOWNERS + Semgrep only) with a working NUnit + Reqnroll + Playwright (C#) sample driven by the BrowserStack .NET SDK.
What's included
Features/Sample.feature+StepDefinitions/SampleSteps.cs— public bstackdemo.com add-to-cart scenarioFeatures/LocalSample.feature+StepDefinitions/LocalSampleSteps.cs— BrowserStack Local scenario (bs-local.com:45454)Hooks/PlaywrightHooks.cs— createsIPageper scenario (SDK routesChromium.LaunchAsync())browserstack.yml— credentials, platforms, Local toggle,framework: nunit.sln/.csproj(Reqnroll.NUnit + NUnit + Microsoft.Playwright.NUnit + BrowserStack.TestAdapter),.gitignore,sanity-workflow.yml, READMEReferences
browserstack/xunit-reqnroll-playwright-browserstack, swapping the xUnit runner for NUnit (packages +Assert.Thatassertions +framework: nunit)browserstack/csharp-playwright-browserstackVerified on BrowserStack ✅
Built and ran both scenarios end-to-end against BrowserStack Automate (.NET 8, arm64), passing on the configured platforms (Windows 11/chrome, OS X Ventura/playwright-webkit)
Reqnroll generated the NUnit tests from the
.featurefiles. Project: BrowserStack Samples.🤖 Generated with Claude Code